﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MessageSystem.Default.infrastructure
{
    public unsafe class msg
    {
        public msg next;
        public UInt32 readpos;
        public UInt32 writepos;
        public UInt32 totalsize;
        public block data;

        public msg()
        {
            next = null;
            readpos = writepos = totalsize = 0;
            data = null;
        }

        public int offset()
        {
            return (int)readpos;
        }

        public byte* baseoffset()
        {
            return &(data.Point[readpos]);
        }

        public UInt32 getlen()
        {
            return writepos - readpos;
        }

        public void setlen(UInt32 length)
        {
            writepos = readpos + length;
        }

        public void advance(UInt32 length)
        {
            readpos += length;
        }
    }
}
